package demo07;

/**
 * @author: WangPeng
 * @createTime: 2022/11/01 17:47
 * @description:
 * @version: v1.0
 */
public class Girl extends Thread{
    public Girl (String name){
        super(name);
    }
    @Override
    public void run() {
        synchronized (LockObject.LOCK2){
//            System.out.println(Thread.currentThread().getName()+"获取一个筷子");
            System.out.println(Thread.currentThread().getName()+"获取一个画笔");
            synchronized (LockObject.LOCK1){
//              System.out.println(Thread.currentThread().getName()+"获取另一根筷子");
//              System.out.println(Thread.currentThread().getName()+"可以吃饭了");
                System.out.println(Thread.currentThread().getName()+"获取另一个画板");
                System.out.println(Thread.currentThread().getName()+"可以画画了");
            }
        }
    }
}
